<?php


class Tipe_Dao{

	function __construct(){
	}
	
	//mendapatkan seluruh data tipe 
	function get_all(){
		$sql="
		select *
		from
		tipe
		";
		
		$list_tipe = array();
		
		$data = mysql_query($sql);
		if($data){
			while($row = mysql_fetch_assoc($data)){
			
				$tipe = new Tipe();
				$tipe->id_tipe = $row['ID_TIPE'];
				$tipe->tipe= $row['TIPE'];				
				$list_tipe[] = $tipe;
			}
		}	
		return $list_tipe;
	}
	
	//mendapatkan data tipe berupa array berdasarkan parameter id_tipe
	function get_id($id_tipe){
		$sql="
		select *
		from
		tipe
		WHERE
		ID_TIPE = '".$id_tipe."'
		";
		
		$tipe=false;		
		$data = mysql_query($sql);
		if($data){
			while($row = mysql_fetch_assoc($data)){
				
				$tipe = new Tipe();
				$tipe->id_tipe = $row['ID_TIPE'];
				$tipe->tipe= $row['TIPE'];
			}
		}	
		return $tipe;
	}
	

}

class Tipe{
	var $id_tipe;
	var $tipe;

}